package org.ch04.test00.lx02;

/**
 * @author ZQX
 * @date 2025-03-31
 */
public class SumUtil {
    /**
     * 计算 1 - N 的和
     *
     * @param n
     * @return
     */
    public static int getSum(@Max(1000) int n) {
        int s = 0;

        for (int i = 0; i <= n; i++) {
            s += i;
        }

        return s;
    }
}
